﻿package plugin.gameHall.game.vplan
{
    import com.core.*;
    import flash.events.*;
    import morn.core.components.*;
    import morn.core.handlers.*;
    import plugin.platform.*;
    import uiresource.vplan.*;
    import view.mornExtends.*;
    import vo.*;

    public class TeGongLiBaoCtrl extends TeGongLiBaoUI implements IVplan
    {

        public function TeGongLiBaoCtrl()
        {
            return;
        }// end function

        override protected function initializeView() : void
        {
            super.initializeView();
            var _loc_1:* = ModelProxy.getValue("data", "configs.vlevelgift");
            var _loc_2:* = _loc_1[1];
            this.showItem(_loc_2);
            lingquBtn.addEventListener(MouseEvent.CLICK, this.lingquBtnClickHandler);
            return;
        }// end function

        protected function lingquBtnClickHandler(event:MouseEvent) : void
        {
            PlatformSender._11360Antivirus(1);
            return;
        }// end function

        private function showItem(param1:int) : void
        {
            var _loc_7:String = null;
            var _loc_8:Array = null;
            var _loc_9:Object = null;
            var _loc_2:* = ConfigDictionary.data.box;
            var _loc_3:* = ConfigDictionary.data.item;
            var _loc_4:Array = [];
            var _loc_5:* = (_loc_2[param1].items as String).split(";");
            var _loc_6:int = 0;
            while (_loc_6 < _loc_5.length)
            {
                
                _loc_7 = _loc_5[_loc_6];
                _loc_8 = _loc_7.split("-");
                if (_loc_8.length >= 4)
                {
                    if (_loc_8[3] != 2 && _loc_8[3] != ModelProxy.getValue("data", "user.sex"))
                    {
                        ;
                    }
                }
                if (_loc_8.length >= 5)
                {
                    if (_loc_8[4] != 0 && _loc_8[4] != ModelProxy.getValue("data", "user.career"))
                    {
                        ;
                    }
                }
                _loc_9 = ItemObject.create(_loc_3[_loc_8[0]]);
                _loc_9.count = _loc_8[1];
                _loc_4.push(_loc_9);
                _loc_6++;
            }
            (this.getChildByName("itemList") as List).array = _loc_4;
            (this.getChildByName("itemList") as List).renderHandler = new Handler(this.itemRender);
            return;
        }// end function

        private function itemRender(param1:Component, param2:int) : void
        {
            if (param1 && param1.dataSource)
            {
                (param1 as FlashItem).data = param1.dataSource;
            }
            return;
        }// end function

        public function update() : void
        {
            var _loc_1:* = ModelProxy.getValue("data", "vlevelGift");
            if (_loc_1 && _loc_1.indexOf(1) >= 0)
            {
                lingquBtn.disabled = true;
            }
            return;
        }// end function

        public function showplan() : void
        {
            this.visible = true;
            this.update();
            return;
        }// end function

        public function closeplan() : void
        {
            this.visible = false;
            return;
        }// end function

    }
}
